import 'package:flutter/material.dart';
import 'package:flutter_demo/services/user.dart';
import 'package:flutter_demo/services/wp_http.dart';
import 'package:flutter_demo/utils/loading.dart';
import 'package:flutter_demo/utils/storage.dart';
import 'package:get/get.dart';

import 'services/config.dart';

class Global {
  static Future<void> init() async {
    // 插件初始化
    WidgetsFlutterBinding.ensureInitialized();

    // 工具类
    await Storage().init();

    // 配置
    Get.put<ConfigService>(ConfigService());

    // 初始化配置，主题，国际化，字体等
    await ConfigService.to.init();

    // 网络请求
    Get.put<WPHttpService>(WPHttpService());

    // 提示框
    Loading();

    // 用户相关
    Get.put<UserService>(UserService());
  }
}

